// 投掷骰子
#include <bits/stdc++.h>
using namespace std;
bool f[101][101];

int main() {

  for (int i = 1; i <= 6; i++) {
    for (int j = 1; j <= 6; j++) {
      for (int k = 1; k <= 6; k++) {
        int red = 0;
        if (i == 1 || i == 4)
          red += i;
        if (j == 1 || j == 4)
          red += j;
        if (k == 1 || k == 4)
          red += k;
        f[red][i + j + k - red] = true;
      }
    }
  }

  int t;
  cin >> t;
  while (t--) {
    int A, B;
    // cin >> A >> B; //超时
    scanf("%d %d", &A, &B);
    printf("%s\n", (f[A][B] ? "YES" : "NO"));
  }

  return 0;
}